package cn.jjxx.modules.pb.entity;

import cn.jjxx.core.common.entity.AbstractEntity;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import org.framework.superutil.thirdparty.excel.Excel;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**   
 * @Title: 党组织考核
 * @Description: 党组织考核
 * @author TianShixi
 * @date 2021-07-26 15:33:19
 * @version V1.0   
 *
 */
@TableName("pb_check")
@SuppressWarnings("serial")
public class PbCheck extends AbstractEntity<String> {

    /**字段主键*/
    @Excel(name="字段主键")
    @TableId(value = "id", type = IdType.UUID)
	private String id;
    /**公司类型*/
    @Excel(name="公司类型")
    @TableField(value = "type")
	private String type;
    /**组织名称*/
    @Excel(name="组织名称")
    @TableField(value = "org_name")
	private String orgName;
    /**基础分*/
    @Excel(name="基础分")
    @TableField(value = "base_score")
	private Integer baseScore;
    /**考核分*/
    @Excel(name="考核分")
    @TableField(value = "check_score")
	private Integer checkScore;



    public static List<PbCheck> fromJsonObject(Map<String,Object> obj){
    	List<Map<String,Object>> aux = (List<Map<String,Object>>)obj.get("aux");
		List<Map<String,Object>> eng = (List<Map<String,Object>>)obj.get("eng");

		List<PbCheck> result = new ArrayList<>();
    	for(Map<String,Object> map:aux){
    		PbCheck entity = new PbCheck();
    		entity.setType("aux");
    		entity.setOrgName(map.get("orgName").toString());
    		Object baseScoreObject = map.get("lastBaseScore");
    		if(baseScoreObject!=null){
    			entity.setBaseScore(Integer.valueOf(baseScoreObject.toString()));
			}
    		Object lastCheckScoreObject = map.get("lastCheckScore");
    		if(lastCheckScoreObject !=null){
    			entity.setCheckScore(Integer.valueOf(lastCheckScoreObject.toString()));
			}
    		result.add(entity);
		}
		for(Map<String,Object> map:eng){
			PbCheck entity = new PbCheck();
			entity.setType("eng");
			entity.setOrgName(map.get("orgName").toString());
			Object baseScoreObject = map.get("lastBaseScore");
			if(baseScoreObject!=null){
				entity.setBaseScore((int)Float.parseFloat(baseScoreObject.toString()));
			}
			Object lastCheckScoreObject = map.get("lastCheckScore");
			if(lastCheckScoreObject !=null){
				entity.setCheckScore((int)Float.parseFloat(lastCheckScoreObject.toString()));
			}
			result.add(entity);
		}
    	return result;
	}



	/**
	 * 获取  id
	 *@return: String  字段主键
	 */
	public String getId(){
		return this.id;
	}

	/**
	 * 设置  id
	 *@param: id  字段主键
	 */
	public void setId(String id){
		this.id = id;
	}
	/**
	 * 获取  type
	 *@return: String  公司类型
	 */
	public String getType(){
		return this.type;
	}

	/**
	 * 设置  type
	 *@param: type  公司类型
	 */
	public void setType(String type){
		this.type = type;
	}
	/**
	 * 获取  name
	 *@return: String  组织名称
	 */
	public String getOrgName(){
		return this.orgName;
	}

	/**
	 * 设置  name
	 *@param: name  组织名称
	 */
	public void setOrgName(String orgName){
		this.orgName = orgName;
	}
	/**
	 * 获取  baseScore
	 *@return: Integer  基础分
	 */
	public Integer getBaseScore(){
		return this.baseScore;
	}

	/**
	 * 设置  baseScore
	 *@param: baseScore  基础分
	 */
	public void setBaseScore(Integer baseScore){
		this.baseScore = baseScore;
	}
	/**
	 * 获取  checkScore
	 *@return: Integer  考核分
	 */
	public Integer getCheckScore(){
		return this.checkScore;
	}

	/**
	 * 设置  checkScore
	 *@param: checkScore  考核分
	 */
	public void setCheckScore(Integer checkScore){
		this.checkScore = checkScore;
	}
	
}
